﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
using System.Xml.Serialization;
using Kis.Xroad.Eu;
using NUnit.Framework;

namespace Xtee.Core.Test
{
    [TestFixture]
    public class SystemSerializerTests
    {
        [Test]
        public void CanSerializeDtosToBinary()
        {
            var binaryFormatter = new BinaryFormatter();

            var menetlus = new Menetlus(new ToimingOsaline(1, "eesnimi","perenimi"));

            using (var ms= new MemoryStream())
            {
                binaryFormatter.Serialize(ms, menetlus);
                
                ms.Position = 0;
                
                var menetlusDeSerialized = (Menetlus)binaryFormatter.Deserialize(ms);

                Assert.That(menetlus.Osaline.Eesnimi == menetlusDeSerialized.Osaline.Eesnimi);
                Assert.That(menetlus.Osaline.Perenimi == menetlusDeSerialized.Osaline.Perenimi);
            }
            
        }
    }
}
